Skip to content

feat(lazer): improve time types #2851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

Riateche
Copy link
Contributor

@Riateche Riateche commented Jul 11, 2025

Summary

  • Add DurationUs
  • Make inner field private
  • Add all necessary methods for working with them
  • Add more conversions to other types

Rationale

To simplify the code, make it more robust and make checked operations on timestamps easier.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Tested with lazer tests as well.

Copy link

vercel bot commented Jul 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 4:25pm
component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 4:25pm
developer-hub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 4:25pm
entropy-debugger ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 4:25pm
entropy-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 4:25pm
insights ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 4:25pm
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 4:25pm
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 4:25pm

pub fn is_multiple_of(self, other: DurationUs) -> bool {
match self.0.checked_rem(other.0) {
Some(rem) => rem == 0,
None => false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't 0 a multiple of any number?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants